package com.itheima.reggie.common;


import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    public R exceptionHandler1(Exception e){
        e.printStackTrace();
        return R.error("系统异常...");
    }

    @ExceptionHandler(RepeatException.class)
    public R exceptionHandler2(RepeatException ex){
        return R.error(ex.getMessage());
    }
}
